#FROM nginx:stable-alpine
## author
#MAINTAINER oddfar
## 复制html文件到路径
#COPY  ./vue_campus_admin/dist/ /usr/share/nginx/html
## 复制conf文件到路径
#COPY  ./doc/docker/nginx/conf/nginx.conf /etc/nginx/nginx.conf

# Stage 1: Build the frontend application
FROM node:14 as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install --registry=https://registry.npmmirror.com
COPY . .
RUN npm run build:prod

# Stage 2: Serve the application using Nginx
FROM nginx:latest as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
# 复制自定义的 Nginx 配置文件到镜像中
COPY ./nginx.conf /etc/nginx/nginx.conf
# 重新设置权限
RUN chmod 644 /etc/nginx/

CMD ["nginx", "-g", "daemon off;"]
